package com.iapp.controller;

import com.iapp.po.AdminUser;
import com.iapp.po.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


/**
 * @author Administrator
 */
@Controller
public class BackController {
    @GetMapping("login")
    public String toLogin(){
        return "/login";
    }
    @GetMapping("register")
    public String toRegister(){
        return "/register";
    }
    @GetMapping("main")
    public String main(HttpServletRequest request){
       AdminUser adminUser= (AdminUser) request.getSession().getAttribute("adminUser");
       if(adminUser==null){
           return "/login";
       }else {
           adminUser.getAdminId();
       }
        return "/index";
    }
}
